﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using YW.Common;
using LTP.Accounts.Bus;
namespace YW.Web.HYXT.yw_hyyeb
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					Guid yw_id=new Guid(Request.Params["id"]);
					ShowInfo(yw_id);
				}
			}
		}
			
	private void ShowInfo(Guid yw_id)
	{
		YW.BLL.HYXT.yw_hyyeb bll=new YW.BLL.HYXT.yw_hyyeb();
		YW.Model.HYXT.yw_hyyeb model=bll.GetModel(yw_id);
		this.lblyw_id.Text=model.yw_id.ToString();
		this.txtEMPI.Text=model.EMPI;
		this.txtxyye.Text=model.xyye.ToString();
		this.txtxyjf.Text=model.xyjf.ToString();

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtEMPI.Text.Trim().Length==0)
			{
				strErr+="EMPI不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtxyye.Text))
			{
				strErr+="现有余额格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtxyjf.Text))
			{
				strErr+="现有积分格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			Guid yw_id= new Guid(this.lblyw_id.Text);
			string EMPI=this.txtEMPI.Text;
			decimal xyye=decimal.Parse(this.txtxyye.Text);
			decimal xyjf=decimal.Parse(this.txtxyjf.Text);


			YW.Model.HYXT.yw_hyyeb model=new YW.Model.HYXT.yw_hyyeb();
			model.yw_id=yw_id;
			model.EMPI=EMPI;
			model.xyye=xyye;
			model.xyjf=xyjf;

			YW.BLL.HYXT.yw_hyyeb bll=new YW.BLL.HYXT.yw_hyyeb();
			bll.Update(model);
			YW.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
